/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package javafiles;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;
import java.util.StringTokenizer;

/**
 *
 * @author human
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws IOException {
        Scanner scanner = new Scanner(new FileInputStream(new File("words.txt")), "Windows-1251");
        
        StringBuilder sb = new StringBuilder();
//        while (scanner.hasNextLine()) {
//            sb.append(scanner.nextLine()).append("\n");
//        }
        
//        Arrays.
//        Collections.
        
        String buffer = sb.toString();
        
//        System.out.println(buffer);
        
        StringTokenizer st = new StringTokenizer(buffer, " ,.!?\"'");
        
        Set<String> words = new HashSet<>();
        
        while (st.hasMoreTokens()) {
            words.add(st.nextToken());
        }
        
//        for (String word : words) {
//            System.out.println(word);
//        }
        
        while (scanner.hasNext()) {
            System.out.println(scanner.next());
        }
    }
}
